package com.renaud.tvSpy;

import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;


public class Capter {

	private Robot robot;
	private Rectangle rect;

	public Capter(VideoDevice device) {
		
		try {
			this.robot = new Robot(device.getDevice());
			this.rect = new Rectangle(new Dimension(device.getLargeur(),device.getHauteur()));
			
		} catch (AWTException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	public Image getImage(){
		BufferedImage image = this.robot.createScreenCapture(this.rect);
		
		return image;
	}
}
